<%
layout("/_container.html",{
	js:'<script src="${ctxPath}/static/admin/js/module/xtree/layui-xtree.js" type="text/javascript" charset="utf-8">'
}){
%>	

	<body>
		<div class="wrap-container">
			<form class="layui-form" style="width: 90%;padding-top: 20px;" action="">
				<input type="hidden" name="id" value="${role.id!}"/>
				<#input label="角色英文名" name="role" placeholder="请输入角色英文名" value="${role.role!}"/>
				<#input label="角色中文名" name="description" placeholder="请输入角色中文名" value="${role.description!}"/>
				<#textarea label="具体描述" name="memo" placeholder="具体描述" value="${role.memo!}"/>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
				<div id="xtree1" class="xtree_contianer"></div>
				</form>
		</div>

		<script>
			layui.use(['form'], function() {
				var form = layui.form();
				var xtree1 = new layuiXtree({
				      elem: 'xtree1'   //(必填) 放置xtree的容器id，不要带#号
				      , form: form     //(必填) layui 的 from
				      , data: [
				               {
				                   title: "节点1", value: "jd1", data: [
				                   { title: "节点1.1", checked: true, disabled: true, value: "jd1.1", data: [] }
				                  , { title: "节点1.2", value: "jd1.2", checked: true, data: [] }
				                  , { title: "节点1.3", value: "jd1.3", disabled: true, data: [] }
				                  , { title: "节点1.4", value: "jd1.4", data: [] }
				                  ]
				              }
				            , {
				                  title: "节点2", value: "jd2", data: [
				                  { title: "节点2.1", value: "jd2.1", data: [] }
				                  , { title: "节点2.2", value: "jd2.2", data: [] }
				                  , { title: "节点2.3", value: "jd2.3", data: [] }
				                  , { title: "节点2.4", value: "jd2.4", data: [] }
				                  ]
				              }
				              , { title: "节点3", value: "jd3", data: [] }
				              , { title: "节点4", value: "jd4", data: [] }
				          ]
				});
				
				
				form.render();
				//监听提交
				form.on('submit(formDemo)', function(data) {
					 layui.jquery.post("/role/save",data.field,function(data){
						index = parent.layer.index;
						if(data){
							parent.refresh();
							parent.dialog.success("操作成功");
						}else
							parent.dialog.error("操作失败,请重试");
					}); 
					return false;
				});
				
				
				
			});
					
			
		</script>
<% } %>